#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
#include "errsys.h"

int main(int argc, char **argv)
{
	if(argc != 2){
		printf("%s dir\n", argv[0]);
		exit(1);
	}

	DIR *dp = opendir(argv[1]);
	if(!dp)
		err_sys("opendir");

	struct dirent *dirp;
	while( (dirp=readdir(dp)) != NULL )
		printf("%s\n", dirp->d_name);

	closedir(dp);

	return 0;
}

